package Epic;

import java.util.Scanner;


/**
 * Given a number find whether the digits in the number 
 * can be used to form an equation with + and '='
 * @author Ray
 *
 */
public class digits_can_be_sumup {
	
	public static int count = 0;
	
	public static void digitsAdd(String num){
		if(num==null || num.length()==0) return;
		for(int i=0;i<num.length()/2;++i){
			for(int j=i+1;j<num.length()-1;++j){
				int num1 = Integer.parseInt(num.substring(0,i+1));
				int num2 = Integer.parseInt(num.substring(i+1,j+1));
				int num3 = Integer.parseInt(num.substring(j+1,num.length()));
				boolean temp = check(num1,num2,num3);
				if(temp){
					break;
//					count++;
				}
			}
		}
	}
	
	private static boolean check(int num1, int num2, int num3){
//		count++;
		if(num1+num2==num3){
			System.out.println(num1 +"+"+num2+"="+num3);
			return true;
		}
		else if(num2+num3==num1){
			System.out.println(num2+"+"+num3+"="+num1);
			return true;
		}
		else if(num3+num1==num2){
			System.out.println(num1+"+"+num3+"="+num2);
			return true;
		}
		else 
			return false;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("Enter the number");
		Scanner in = new Scanner(System.in);
		String num = in.nextLine();
		digitsAdd(num);
		in.close();
	}

}
